let useBoo,pwdBoo;
$('#phone').blur(()=>{
    let rge=/^1[34578]\d{9}$/;
    if(rge.test($('#phone').val())){
        useBoo=true;

    }
    else{
        console.log("手机号码有误，请重填");
    }
});
$('#password').blur(()=>{
    let rge=/^(\w){8,20}$/;
    if($('#password').val().length >= 8) {
        if (rge.test($('#password').val())) {
            $('#againpassword').blur(() => {
                if ($('#password').val() == $('#againpassword').val()) {
                    pwdBoo = true;
                }
                else {
                    console.log("两次密码输入有误，请重填");
                }
            });
        }
        else {
            console.log("密码输入有误，请重填");
        }
    }
    else{
        console.log("密码长度不能少于8位");
    }
});






$('#reg').click(()=>{
    if (useBoo==pwdBoo==true){
        $.ajax({
            type:'post',
            url:'http://www.shouziliu.com/LTO/user/register.php',
            data:{
                "username":$('#phone').val(),
                "password":$('#password').val(),
            },
            success:(data)=>{
                console.log(data);
            }
        });
    }
    else {

    }
});


